/*
 * @Author: Lizhenyu
 * @Date: 2021-07-07 16:52:52
 * @FilePath: \usp-osm-frondend\src\api\userMgmt.js
 */
import { service } from '@/utils/request'

const api = {
  GetUserMgmt: '/admin/account/sysUser/list',
  EditUserStatus: '/admin/account/sysUser/edit',
  GetAccountDetail: '/admin/account/sysUser/editClick',
  GetAllRoles: '/admin/role-2b/api/roles/role-list',
  ResetPassword: '/admin/account-mgmt-2b/api/account/reset-password',
  changeStatus: '/admin/account/sysUser/batch-status'
}

export function getUserMgmt (data) {
  return service({
    url: api.GetUserMgmt,
    method: 'post',
    data
  })
}

export function editUser (data) {
  return service({
    url: api.EditUserStatus,
    method: 'post',
    data
  })
}

export function getAccountDetail (id) {
  return service({
    url: api.GetAccountDetail + `/${id}`,
    method: 'get'
  })
}

export function getAccountAllRoles (data) {
  return service({
    url: api.GetAllRoles,
    method: 'post',
    data
  })
}

export function resetPsw (data) {
  return service({
    url: api.ResetPassword,
    method: 'post',
    data
  })
}

export function getAccountByEmail (email) {
  return service({
    url: `/account-mgmt-2b/api/accounts/${email}`,
    method: 'get'
  })
}

export function changeStatus (data) {
  return service({
    url: api.changeStatus,
    method: 'post',
    data
  })
}
